package com.yuexunit.mobilenurse.module.NursingDocuments.ui;

import android.view.View;
import android.widget.TextView;

import com.yuexunit.mobilenurse.R;
import com.yuexunit.mobilenurse.base.titlebar.TitleBar_DocAdvice;
import com.yuexunit.mobilenurse.config.AppConfig;
import com.yuexunit.mobilenurse.module.NursingDocuments.bean.DocumentsIdBean;
import com.yuexunit.mobilenurse.module.NursingDocuments.model.impl.DocumentRecordModel;
import com.yuexunit.mobilenurse.module.NursingDocuments.presenter.IDocumentRecordPresenter;
import com.yuexunit.mobilenurse.module.NursingDocuments.presenter.impl.DocumentRecordPresenter;
import com.yuexunit.mobilenurse.module.NursingDocuments.ui.view.IDocumentRecordView;

import org.kymjs.kjframe.utils.PreferenceHelper;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by work-jx on 2016/10/13.
 */
public class Act_Document extends TitleBar_DocAdvice implements IDocumentRecordView{

    @Bind(R.id.titlebar_docadvice_tv_title)
    TextView titlebarDocadviceTvTitle;

    @Bind(R.id.docactvice_name)
    TextView docactviceName;
    @Bind(R.id.docactvice_bedno)
    TextView docactviceBedno;
    @Bind(R.id.docactvice_visitno)
    TextView docactviceVisitno;

    IDocumentRecordPresenter presenter;
    DocumentsIdBean documentsIdBean = new DocumentsIdBean();

    @Override
    public void setRootView() {
        setContentView(R.layout.act_document);
        ButterKnife.bind(this);
        setContent();
        presenter = new DocumentRecordPresenter(new DocumentRecordModel(),this);
        presenter.getRecordId(PreferenceHelper.readString(aty, AppConfig.CURRENT_PATIENT_INFO, AppConfig.CURRENT_PATIENT_VISITNO));
    }


    @OnClick({R.id.titlebar_docadvice_img_back, R.id.document_ll_01,R.id.document_ll_02,R.id.document_ll_03,R.id.document_ll_04,R.id.document_ll_05, R.id.document_ll_06})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.titlebar_docadvice_img_back:
                finish();
                break;
            case R.id.document_ll_01:
                showActivity(aty, Act_DocumentRecordDetail.class);
                break;
            case R.id.document_ll_02:
                showActivity(aty, Act_DocumentPainDetail.class);
                break;
            case R.id.document_ll_03:
                showActivity(aty, Act_DocumentBloodSugarDetail.class);
                break;
            case R.id.document_ll_04:
                showActivity(aty, Act_DocumentAcromegalicDetail.class);
                break;
            case R.id.document_ll_05:
                showActivity(aty, Act_DocumentPrenatalDetail.class);
                break;
            case R.id.document_ll_06:
                showActivity(aty, Act_DocumentADLAssessmentDetail.class);
                break;
        }
    }

    public void setContent()
    {
        titlebarDocadviceTvTitle.setText("护理文书");
        docactviceName.setText(PreferenceHelper.readString(aty, AppConfig.CURRENT_PATIENT_INFO, AppConfig.CURRENT_PATIENT_NAME));
        docactviceBedno.setText(PreferenceHelper.readString(aty, AppConfig.CURRENT_PATIENT_INFO, AppConfig.CURRENT_PATIENT_BEDCODE));
        docactviceVisitno.setText(PreferenceHelper.readString(aty, AppConfig.CURRENT_PATIENT_INFO, AppConfig.CURRENT_PATIENT_VISITNO));
    }

    @Override
    public void showdocumentId(DocumentsIdBean documentsIdBean) {
        this.documentsIdBean =documentsIdBean;
    }
}
